package com.firstwave.sfsayhello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class SfSayhelloApplication {

    @RequestMapping("/sayhello")
    public String sayhello(){

        List<String> geets = Arrays.asList("hello1","hello2","hello3");
        Random random = new Random();
        String res = geets.get(random.nextInt(3));
        System.out.println(res);
        return res;

    }
    @RequestMapping("/")
    public String home(){
        return "Hi!!";
    }

    public static void main(String[] args) {
        SpringApplication.run(SfSayhelloApplication.class, args);
    }

}
